const jwt = require("jwt-simple");

const username = "laowang";

const secret = "15701665566";

//生成token
const token = jwt.encode(
  {
    username: username,
    exp: Date.now() / 1000 + 5,
  },
  secret
);

/* eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.
eyJ1c2VybmFtZSI6Imxhb3dhbmciLCJleHAiOjE2NTY1ODUwNjYuMjg2fQ.
41OsP-uEabclq1ioOHhKf8VBMzZDCeRlScGRlqgYp7A */

console.log(token);

//对token进行解码
const re = jwt.decode(token,secret)
console.log(re);

